var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(d, c, b) {
    if (status == 0 && d == 0) {
        cm.dispose();
        return
    }
    if (!cm.isQuestActive(64018) && !cm.isQuestActive(64029)) {
        cm.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            cm.curNodeEventEnd(true);
            cm.setInGameDirectionMode(true, false, true);
            cm.Hidden_background("guide135", 0);
            cm.onTeleport(0, 3, cm.getPlayer().getId(), 1696, 352);
            cm.inGameDirectionEvent_AskAnswerTime(120)
        } else {
            if (status === a++) {
                cm.inGameDirectionEvent_ForcedFlip(-1);
                cm.inGameDirectionEvent_AskAnswerTime(120)
            } else {
                if (status === a++) {
                    cm.inGameDirectionEvent_OneTimeAction(2034, 9999);
                    cm.inGameDirectionEvent_QTE(1000)
                } else {
                    if (status === a++) {
                        cm.npc_SetSpecialAction("oid=建筑残骸69", "state2", -1, 0);
                        cm.inGameDirectionEvent_OneTimeAction(2035, 9999);
                        cm.inGameDirectionEvent_QTE(1000)
                    } else {
                        if (status === a++) {
                            cm.npc_SetSpecialAction("oid=建筑残骸69", "state3", -1, 0);
                            cm.inGameDirectionEvent_OneTimeAction(2036, 9999);
                            cm.inGameDirectionEvent_QTE(1000)
                        } else {
                            if (status === a++) {
                                cm.setNpcSpecialActionReset("oid=建筑残骸69");
                                cm.fieldEffect_PlayFieldSound("Sound/PL_MONAD.img/EP1/ACT1/reactordrop1", 128);
                                cm.npc_SetSpecialAction("oid=建筑残骸69", "hit", 0, 0);
                                cm.inGameDirectionEvent_AskAnswerTime(900)
                            } else {
                                if (status === a++) {
                                    cm.npc_LeaveField("oid=建筑残骸69");
                                    cm.setInGameDirectionMode(false, true, false);
                                    if (cm.isQuestActive(64018)) {
                                        if (!cm.haveItem(4036368)) {
                                            cm.getMap().spawnAutoDrop(4036368, new java.awt.Point(1633, 354))
                                        }
                                    } else {
                                        if (cm.isQuestActive(64029)) {
                                            cm.getMap().spawnAutoDrop(4036371, new java.awt.Point(1633, 354))
                                        }
                                    }
                                    cm.dispose()
                                }
                            }
                        }
                    }
                }
            }
        }
    }
};